#include "uti_orderseries.h"




OrderSeries::OrderSeries(OrderSerInfo* pOrderserinfo)
{
	memcpy(&m_orderserinfo, pOrderserinfo, sizeof(m_orderserinfo));

	m_pmemman = new MemMan<OrderData>(m_orderserinfo.sersize, m_orderserinfo.p);

	m_pmemman->InitUnitPointer(&m_pordercur, &m_orderindex);

}

OrderSeries::~OrderSeries()
{
	if (NULL != m_pmemman)
	{
		delete m_pmemman;
	}
}


void OrderSeries::Addorder(CThostFtdcOrderField* pOrder)
{
	if (m_pordercur->ordercnt != 0) 
	{

		m_pmemman->NextUnitPointer(&m_pordercur,&m_orderindex);//get cur bar pointer and index

	}

	m_pordercur->ordercnt++;

	memcpy(&m_pordercur->data, pOrder, sizeof(CThostFtdcOrderField));

}




